package com.study.d9_map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Test {
    public static void main(String[] args) {
        //掌握Map集合的常用API
        Map<String,Integer> map = new HashMap<>();
        map.put("C语言",20);
        map.put("Java",30);
        map.put("Go",30);
        map.put("CPP",35);
        map.put(null,null);
        System.out.println(map);

        System.out.println(map.size());
        System.out.println(map.get("Java"));
        System.out.println(map.get("haha"));
        System.out.println(map.remove("CPP"));
        System.out.println(map);
        System.out.println(map.containsKey("Go"));
        System.out.println(map.containsValue(20));
        Set<String> strings = map.keySet();
        for (String string : strings) {
            System.out.println(string);
        }
    }
}
